/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.niftygui.NiftyJmeDisplay;
import de.lessvoid.nifty.Nifty;

/**
 * @date 2024年7月11日14点25分
 * @author JohnKkk
 */
public class NiftyGui01 extends SimpleApplication{

    private Nifty m_Nifty;

    @Override
    public void simpleInitApp() {
        // 初始化Nifty
        NiftyJmeDisplay niftyDisplay = NiftyJmeDisplay.newNiftyJmeDisplay(
                assetManager,
                inputManager,
                audioRenderer,
                guiViewPort);
        m_Nifty = niftyDisplay.getNifty();
        // 将NiftyGUI显示对象添加到JME3中
        guiViewPort.addProcessor(niftyDisplay);
        
//        // 加载xml布局文件,设置默认屏幕为screen0
//        m_Nifty.fromXml("Interface/NiftyGui01.xml", "");
//        m_Nifty.getScreen("screen0").getLayerElements().get(1).hide();
//        m_Nifty.gotoScreen("screen0");
//        m_Nifty.gotoScreen("screen1");

        // 添加多个xml
        m_Nifty.addXml("Interface/NiftyGui01.xml");
        m_Nifty.addXml("Interface/NiftyGui011.xml");
        // 启动id为screen2的screen
        m_Nifty.gotoScreen("screen2");
    }
    
    public static void main(String[] args) {
        NiftyGui01 niftyGui01 = new NiftyGui01();
        niftyGui01.start();
    }
}
